
stan_diag(object,
information = c("sample","stepsize", "treedepth","divergence"),
chain = 0, ...)
stan_par(object, par, chain = 0, ...)
stan_rhat(object, pars, ...)
stan_ess(object, pars, ...)
stan_mcse(object, pars, ...)
par
) or
one or more parameter names (pars
).chain=0
(the default) all chains are combined.
Otherwise the plot for chain
is overlaid on the plot for all chains
combined.stan_diag
and stan_par
, optional arguments to
arrangeGrob
. For stan_rhat
, stan_ess
,
and stan_mcse
, optional arguments to stat_bin
.stan_diag
and stan_par
, a list containing the ggplot objects for
each of the displayed plots. For stan_rhat
, stan_ess
,
and stan_mcse
, a single ggplot object.stan_rhat
,stan_ess
,stan_mcse
stan_par
stan_par
generates three plots:
(i) a scatterplot of par
vs. the accumulated log-posterior (lp__
),
(ii) a scatterplot of par
vs. the average Metropolis acceptance rate
(accept_stat
), and
(iii) a violin plot showing the distribution of par
at each of the
sampled step sizes (one per chain).
For the scatterplots, red points are superimposed to indicate which
(if any) iterations encountered a divergent transition. Yellow points indicate
a transition that hit the maximum treedepth rather than terminated its
evolution normally.stan_diag
information
argument is used to specify which
plots stan_diag
should generate: information='sample'
Histograms of lp__
and accept_stat
, as well as a scatterplot showing their
joint distribution.
information='stepsize'
Violin plots showing the
distributions of lp__
and accept_stat
at each of the sampled
step sizes (one per chain).
information='treedepth'
Histogram of treedepth
and
violin plots showing the distributions of lp__
and
accept_stat
for each value of treedepth
.
information='divergence'
Violin plots showing the
distributions of lp__
and accept_stat
for iterations that
encountered divergent transitions (divergent=1
) and those that
did not (divergent=0
).
List of RStan plotting functions
,
Plot options
## Not run: ------------------------------------
# fit <- stan_demo("eight_schools")
#
# stan_diag(fit, info = 'sample') # shows three plots together
# samp_info <- stan_diag(fit, info = 'sample') # saves the three plots in a list
# samp_info[[3]] # access just the third plot
#
# stan_diag(fit, info = 'sample', chain = 1) # overlay chain 1
#
# stan_par(fit, par = "mu")
## ---------------------------------------------
Run the code above in your browser using DataLab